﻿using Abp.Localization;
using Abp.MultiTenancy;
using Mt.Site.EntityFrameworkCore;
using System.Collections.Generic;

namespace Mt.Site.Migrations.Seed.Tenants
{
    public class InitialDefaultTenantDbBuilder
    {
        private readonly MtSiteDbContext _context;

        public InitialDefaultTenantDbBuilder(MtSiteDbContext context)
        {
            _context = context;
        }

        public void Create(string defaultTenantName)
        {
            new DefaultTenantBuilder(_context).Create(defaultTenantName);

            new DefaultTenantLanguagesCreator(_context, MultiTenancyConsts.DefaultTenantId).Create();
            new TenantRoleAndUserBuilder(_context, MultiTenancyConsts.DefaultTenantId).Create();

            _context.SaveChanges();
        }
    }
}
